// pages/news-detail/news-detail.js
const app = getApp();
const util = require('../../utils/util.js');
var WxParse = require('../../utils/wxParse/wxParse.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
    title: '',
    content: '',
    titlePhoto: '',
    author: '',
    createTime: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    app.request('/New/NewDetail', 'GET', { newId: options.newsId }, res => {
      this.setData({
        title: res.title,
        titlePhoto: res.titlePhoto,
        author: res.author,
        createTime: util.formatTime(res.createTime)
      });
      WxParse.wxParse('article', 'html', res.content, this, 5);
    });
  }
})